<? 
	include("var.php");
	include("../header.php"); //header untuk banner web site
?>
<script language="javascript" type="text/javascript">
	function PromptSearch(){
	var Key = prompt("Masukkan Kata Kunci Anda:");
	
		if(Key){
			//alert("dsds");
		//window.location.href="search.php?show=report_emp&key="+Key"";
			top.location.href="search.php?show=report_emp&key="+ Key +" ";
		}
	}
	
	function DisableField()
	{
		
		if (document.getElementById("cek").checked == true)
		{
		document.forms[0].pendidikan.disabled = false;
		document.forms[0].fungsional.disabled = false;
		document.forms[0].skill.disabled = false;
		document.forms[0].status.disabled = false;
		}
		else
		{
		document.getElementById("pendidikan").disabled = true;
		document.getElementById("fungsional").disabled = true;
		document.forms[0].skill.disabled = true;
		document.forms[0].status.disabled = true;
		}
	}
	
	function cek_all(){
		var count = document.forms['f1'].elements.length;
		for (i=0; i<count; i++) 
		{
			var element = document.forms['f1'].elements[i]; 
			//if (document.form1.check1.checked == true) 
			//{ 
			if (element.type == "checkbox") 
			{ 
				element.checked=true; 
			} 
			//} 
			else 
			{ 
				element.checked=false; 
			}
		}
	}
	
	function not_cek_all(){
		var count = document.forms['f1'].elements.length;
		for (i=0; i<count; i++) 
		{
			var element = document.forms['f1'].elements[i]; 
			//if (document.form1.check1.checked == true) 
			//{ 
			if (element.type == "checkbox") 
			{ 
				element.checked=false; 
			} 
			//} 
			else 
			{ 
				element.checked=true; 
			}
		}
	}

	function Down(){
		document.forms['f1'].submit();
	}
</script>
<?
include("config.php");
include("function.php");
include("header.php");
$page 			= $HTTP_GET_VARS['page']; // get nomor halaman yang dipanggil
$next			= $HTTP_GET_VARS['next']; // get segmen halaman yang dipanggil
$keyword		= $HTTP_GET_VARS['keyword'];
$show			= $HTTP_GET_VARS['show'];
$pendidikan		= $HTTP_GET_VARS['pendidikan'];
$skill			= $HTTP_GET_VARS['skill'];
$fungsional		= $HTTP_GET_VARS['fungsional'];
$status			= $HTTP_GET_VARS['status'];
$cat			= $show;
$key			= $HTTP_GET_VARS['key'];
$st				= $HTTP_GET_VARS['st'];;

/////////////////////////////////////////////////
//	Untuk Pencarian berdasarkan FILTER
/////////////////////////////////////////////////

if($show == "report_emp"){
	echo"
	<table width=100%>
	 <tr>
	  <td colspan=2 class=line_bottom><b>&nbsp;&nbsp;&nbsp;CV ONLINE</b></td>
	 </tr>
	</table>";
	echo"<br>";
	SearchFilter($cat,$conn);
	echo"<table>";
	/*
	// jika yang diisi hanya nama/nik saja (pencarian umum)
	if(!empty($keyword) || $keyword == "" && empty($pendidikan) && empty($skill) && empty($fungsional) && empty($status)){
		$sqlc = "SELECT A.NIK, nama, TempatLahir tempatlahir, Tgl_Lahir, Gender,Alamat,B.keterangan,B.jurusan,Nstat_kerja,fungsional		,
		Propinsi FROM CVKaryawan A, CVPendidikan B, CVStatusKaryawan C 
		WHERE A.NIK=B.NIK AND A.NIK=C.NIK AND (A.NIK LIKE '%$keyword%' OR Nama LIKE '%$keyword%') 
		GROUP BY A.NIK, nama, Gender, TempatLahir, Tgl_Lahir, Alamat, B.keterangan, B.jurusan,Nstat_kerja,fungsional,Propinsi";
	}
	// jika yang diisi hanya nama dan fungsional
	elseif(!empty($keyword) || $keyword == "" && empty($pendidikan) && empty($skill) && !empty($fungsional) && empty($status)){
		$sqlc = "SELECT A.NIK, nama, TempatLahir tempatlahir, Tgl_Lahir, Gender,Alamat,B.keterangan,B.jurusan,Nstat_kerja,fungsional,
		Propinsi FROM CVKaryawan A, CVPendidikan B, CVStatusKaryawan C 
		WHERE A.NIK=B.NIK AND A.NIK=C.NIK AND (A.NIK LIKE '%$keyword%' OR Nama LIKE '%$keyword%') AND fungsional='$fungsional'
		GROUP BY A.NIK, nama, Gender, TempatLahir, Tgl_Lahir, Alamat, B.keterangan, B.jurusan,Nstat_kerja,fungsional,propinsi";
	}
	// jika yang diisi hanya nama dan status kerja
	elseif(!empty($keyword) || $keyword == "" && empty($pendidikan) && empty($skill) && empty($fungsional) && !empty($status)){
		$sqlc = "SELECT A.NIK, nama, TempatLahir tempatlahir, Tgl_Lahir, Gender,Alamat,B.keterangan,B.jurusan,Nstat_kerja,fungsional,
		Propinsi FROM CVKaryawan A, CVPendidikan B, CVStatusKaryawan C 
		WHERE A.NIK=B.NIK AND A.NIK=C.NIK AND (A.NIK LIKE '%$keyword%' OR Nama LIKE '%$keyword%') AND stat_kerja='$status'
		GROUP BY A.NIK, nama, Gender, TempatLahir, Tgl_Lahir, Alamat, B.keterangan, B.jurusan,Nstat_kerja,fungsional,propinsi";
	}
	*/
	
		$sqlc = "SELECT A.NIK, nama, TempatLahir tempatlahir, Tgl_Lahir, Gender,Alamat,B.keterangan,B.jurusan,Nstat_kerja,fungsional,";
		if(!empty($skill)){
			$sqlc .=" program,";
		}
		$sqlc .=" Propinsi FROM CVKaryawan A, CVPendidikan B, CVStatusKaryawan C";
		
		if(!empty($skill)){
			$sqlc .=", CVKursus D ";
		}
		 
		$sqlc .=" WHERE A.NIK=B.NIK AND A.NIK=C.NIK AND (A.NIK LIKE '%$keyword%' OR Nama LIKE '%$keyword%')";
		// jika fungsional saja
		if(!empty($fungsional)){
			$sqlc .=" AND fungsional='$fungsional'";
		}
		// jika status saja
		if(!empty($status)){
			$sqlc .=" AND stat_kerja='$status'";			
		}
		// jika pendidikan
		if(!empty($pendidikan)){
			$sqlc .=" AND B.Pend_ID='$pendidikan'";			
		}		
		
		if(!empty($skill)){
			$sqlc .=" AND A.NIK=D.NIK AND program LIKE '%$skill%'";
		}
				
		$sqlc .= " GROUP BY A.NIK, nama, Gender, TempatLahir, Tgl_Lahir, Alamat, B.keterangan, B.jurusan,Nstat_kerja,fungsional,propinsi";
		
		if(!empty($skill)){
			$sqlc .=",program";
		}
		
	
	$result	= mssql_query($sqlc,$conn);	
	$total	= mssql_num_rows($result);
	//echo"$total";
	$limit	= 20;
	$pager  = Pager::getPagerData($total, $limit, $page);
	$offset = $pager->offset;
	$limit  = $pager->limit;
	$page   = $pager->page;
	
	if($total > 0)
	{
			$sql = "WITH limit AS (SELECT ROW_NUMBER() OVER (ORDER BY A.NIK) AS No, 
			A.NIK, nama, TempatLahir tempatlahir, Tgl_Lahir, Gender,Alamat,B.keterangan,B.jurusan,Nstat_kerja,fungsional,";
			if(!empty($skill)){
				$sql .=" program,";
			} //*/
			$sql .="Propinsi FROM CVKaryawan A, CVPendidikan B, CVStatusKaryawan C";
			///*
			if(!empty($skill)){
				$sql .=", CVKursus D";
			}
			//*/
			$sql .= " WHERE A.NIK=B.NIK AND A.NIK=C.NIK AND (A.NIK LIKE '%$keyword%' OR Nama LIKE '%$keyword%')";
			// jika fungsional saja
			if(!empty($fungsional)){
				$sql .=" AND fungsional='$fungsional' ";
			}
			// jika status saja
			if(!empty($status)){
				$sql .=" AND stat_kerja='$status' ";			
			}
			// jika pendidikan
			if(!empty($pendidikan)){
				$sql .=" AND B.Pend_ID='$pendidikan'";			
			}		
			///*
			if(!empty($skill)){
				$sql .=" AND A.NIK=D.NIK AND program LIKE '%$skill%'";
			}
			//*/

			$sql .= "GROUP BY A.NIK, nama, Gender, TempatLahir, Tgl_Lahir, Alamat, B.keterangan, B.jurusan,Nstat_kerja,fungsional,propinsi"; 
			///*
			if(!empty($skill)){
				$sql .=",program";
			}
			//*/
			$sql .=") SELECT * FROM limit WHERE No BETWEEN ".$offset." AND ".($offset+$limit)."";
		
			
		PagingFilter($pager,$page,$next,$limit,$keyword,$show,$pendidikan,$fungsional,$skill);
		echo"<form method='get' name='f1' action='rep_cv_all.php'>
		[ <a href='Javascript:cek_all();'>Checklist Semua</a> | <a href='Javascript:not_cek_all();'>Unchecklist Semua</a> | <b><a href='Javascript:Down();'>Download Checklist</a></b> ]
		";
		echo"
		<table>";
		HeadKaryawan2();
		$res = mssql_query($sql,$conn);
		//ShowData2($conn,$sql,$cat);
		while($r=mssql_fetch_array($res)){
			echo"
			<tr>
			 	<td valign=top>
				<input type='hidden' name='versi' value='msword'>
				<input type='checkbox' name='cv[]' value='$r[NIK]'></td>
		 		<td class='contentlist'><a href='rep_cv.php?nik=$r[NIK]' target='_blank'>$r[No]</a></td>
				<td class='contentlist'><a href='rep_cv.php?nik=$r[NIK]' target='_blank'>$r[NIK]</a></td>
				<td class='contentlist'><a href='rep_cv.php?nik=$r[NIK]' target='_blank'>$r[nama]</a></td>
				<td class='contentlist'><a href='rep_cv.php?nik=$r[NIK]' target='_blank'>$r[tempatlahir]</a></td>
				<td class='contentlist'><a href='rep_cv.php?nik=$r[NIK]' target='_blank'>$r[Tgl_Lahir]</a></td>
				<td class='contentlist'><a href='rep_cv.php?nik=$r[NIK]' target='_blank'>";
			if($r[Gender] == 0){
				echo"L";
			}
			elseif($r[Gender] == 1){
				echo"P";
			}
			echo"</a></td>
				<td class='contentlist'><a href='rep_cv.php?nik=$r[NIK]' target='_blank'>$r[Alamat] $r[Propinsi]</a></td>
				<td class='contentlist'><a href='rep_cv.php?nik=$r[NIK]' target='_blank'>$r[keterangan] - $r[jurusan]</a></td>
				<td class='contentlist'><a href='rep_cv.php?nik=$r[NIK]' target='_blank'>";
				//get fungsional
				$sf = mssql_query("SELECT nama_fungsi FROM VFungsional WHERE kode_fungsi='$r[fungsional]'",$conn);
				if(mssql_num_rows($sf) > 0){
					$rf = mssql_fetch_array($sf);
					echo"$rf[nama_fungsi]";
				}
			echo"</a></td>
				<td class='contentlist'><a href='rep_cv.php?nik=$r[NIK]' target='_blank'>$r[Nstat_kerja]</a></td>
				<td class='contentlist'><a href='rep_cv.php?versi=msword&amp;nik=$r[NIK]' target='_blank' style='color: blue;'><img src='../images/down.png' border=0 alt='Download' title='Download'></a></td>
			";
		echo"		
			</tr>
		";
			if(!empty($skill)){
				echo"
				 <tr>
				  <td colspan=7 class='contentlist'>&nbsp;</td>
				  <td colspan=5 class='contentlist'><b>TRAINING/SKILL : </b>$r[program]</td>
				 </tr>
				";
			}
		}
		echo"</table>
		<form method='post' name='f1' action=''>
		[ <a href='Javascript:cek_all();'>Checklist Semua</a> | <a href='Javascript:not_cek_all();'>Unchecklist Semua</a> | <b>Download Checklist</b> ]
		</form>";
	}
	else
	{
		echo"
		<table width=100%>
		<tr><td class=zerolist ><br><br>Maaf, pencarian tidak ditemukan ...</td></tr>
		</table>
		</form>
		<br>";
	}	
}

elseif($show == "employee"){
	TitleKaryawan();
	echo"<br>";
	Search($cat);
	echo"<table>";
	if(empty($HTTP_GET_VARS['st'])){
		$sqlcount = "SELECT * FROM Karyawan WHERE Nama LIKE '%$keyword%' OR NIK LIKE '%$keyword%' ";
	}
	elseif(!empty($HTTP_GET_VARS['st'])){
		$sqlcount = "SELECT * FROM Karyawan A, KaryawanStatus B WHERE (Nama LIKE '%$keyword%' OR A.NIK LIKE '%$keyword%') AND A.NIK=B.NIK AND B.stat_kerja='".$HTTP_GET_VARS['st']."' ";
	}
	$result	= mssql_query($sqlcount,$conn);
	$total	= mssql_num_rows($result);
	$limit	= 20;
	$pager  = Pager::getPagerData($total, $limit, $page);
	$offset = $pager->offset;
	$limit  = $pager->limit;
	$page   = $pager->page;
	
	if($total > 0)
	{
	
	if(empty($st)){
		$sql	= "WITH limit AS (SELECT ROW_NUMBER() OVER (ORDER BY NIK) AS 'RowNumber', NIK, Nama, TempatLahir, convert(varchar(12),tgl_lahir,103) tanggal, Alamat, NoTelepon FROM Karyawan WHERE Nama LIKE '%$keyword%' OR NIK LIKE '%$keyword%') SELECT * FROM limit WHERE RowNumber BETWEEN ".$offset." AND ".($offset+$limit).""; 
	}
	elseif(!empty($st)){
		$sql	= "WITH limit AS (SELECT ROW_NUMBER() OVER (ORDER BY A.NIK) AS 'RowNumber', A.NIK, Nama, TempatLahir, convert(varchar(12),tgl_lahir,103) tanggal, Alamat, NoTelepon FROM Karyawan A, KaryawanStatus B WHERE A.NIK=B.NIK AND (Nama LIKE '%$keyword%' OR A.NIK LIKE '%$keyword%') AND B.stat_kerja='".$st."') SELECT * FROM limit WHERE RowNumber BETWEEN ".$offset." AND ".($offset+$limit).""; 
	}

		//PagingFilter($pager,$page,$next,$limit,$keyword,$show,$unit_kerja,$status_kerja);
		Paging($pager,$page,$next,$limit,$keyword,$show,$conn,$st);
		echo"<table>";
		HeadKaryawanFront();
		ShowData($conn,$sql,$cat);
		echo"</table>";
		
	}
	else
	{
		echo"
		<table width=100%>
		<tr><td class=zerolist ><br><br>Maaf, pencarian tidak ditemukan ... <br><br>
		<a href='Javascript:history.back();'>Silahkan Kembali</a>
		</td></tr>
		</table><br>";
	}	
}

// untuk karir di ptsi
elseif($show == "karirptsi"){
	echo"
		<table width=100%>
		 <tr>
		  <td colspan=2 class=line_bottom>&nbsp;&nbsp;<b>Pencarian untuk Karir Karyawan Selama Bekerja di PT. Surveyor Indonesia</b></td>
		 </tr>
		 <tr>
		  <td colspan=2 align=center>
		  <form method='get' action=search.php>
		   <table>
		    <tr>
			 <td width=200 align=right>Masukkan NIK/Nama:</td>
			 <td>
			 <input type='hidden' name='show' value='karirptsi'>
			 <input type='text' name='keyword'><input type=submit value='Cari' class=button></td>
			</tr>
		   </table>
		  </form>
		  </td>
		 </tr>
		 <tr>
		  <td><hr noshade size=-2></td>
		 </tr>
		 <tr>
		  <td colspan=2>&nbsp;</td>
		 </tr>";
		$sql_num 	= mssql_query("SELECT * FROM VKarirPTSI WHERE NIK LIKE '%$keyword%' OR Nama LIKE '%$keyword%' ",$conn);
		$cnt_num	= mssql_num_rows($sql_num);	
		
		if($cnt_num > 0){
		 echo"<tr>
		  <td colspan=2>
		   <table width=100%>
		    <tr class=headlist>
			 <td width=1%>No</td>
			 <td width=80>NIK</td>
			 <td>Nama</td>
			</tr>";

			$sql = mssql_query("SELECT ROW_NUMBER() OVER (ORDER BY NIK) AS No, NIK,Nama FROM VKarirPTSI WHERE NIK LIKE '%$keyword%' OR Nama LIKE '%$keyword%' GROUP BY NIK,Nama",$conn);
			while($row = mssql_fetch_array($sql)){
			  echo"<tr>
				 <td class=contentlist><a href='list_karir.php?show=list_karir&amp;nik=$row[NIK]'>$row[No]</a></td>
				 <td class=contentlist><a href='list_karir.php?show=list_karir&amp;nik=$row[NIK]'>$row[NIK]</a></td>
				 <td class=contentlist><a href='list_karir.php?show=list_karir&amp;nik=$row[NIK]'>$row[Nama]</a></td>
				</tr>";
			}
			//echo"Ada";
		}
		else{
			echo"
			<tr>
			 <td align=center style='color:red; text-indent:50px;'><b>Maaf, Pencarian tidak ditemukan ...</b></td>
			</tr>
			";
			exit();
		}
	   echo"</table>
		  </td>
		 </tr>
		 <tr>
		  <td colspan=2>
		  <br><br><br>
		  <input type=button value='Tambah' class='button' onclick='Javascript:location.href=\"../form/frm_karir_ptsi.php\"'></td>
		 </tr>
		</table>
	";
}
// untuk karir di track record
elseif($show == "track_record"){
	echo"
		<table width=100%>
		 <tr>
		  <td colspan=2 class=line_bottom>&nbsp;&nbsp;<b>PENCARIAN TRACK RECORD</b></td>
		 </tr>
		 <tr>
		  <td colspan=2 align=center>
		  <form method='get' action=search.php>
		   <table>
		    <tr>
			 <td width=200 align=right>Masukkan NIK/Nama:</td>
			 <td>
			 <input type='hidden' name='show' value='track_record'>
			 <input type='text' name='keyword'><input type=submit value='Cari' class=button></td>
			</tr>
		   </table>
		  </form>
		  </td>
		 </tr>
		 <tr>
		  <td><hr noshade size=-2></td>
		 </tr>
		 <tr>
		  <td colspan=2>&nbsp;</td>
		 </tr>";
		$sql_num 	= mssql_query("SELECT * FROM VTrackRecord WHERE NIK LIKE '%$keyword%' OR Nama LIKE '%$keyword%' ",$conn);
		$cnt_num	= mssql_num_rows($sql_num);	
		
		if($cnt_num > 0){
		 echo"<tr>
		  <td colspan=2>
		   <table width=100%>
		    <tr class=headlist>
			 <td width=1%>No</td>
			 <td width=80>NIK</td>
			 <td>Nama</td>
			</tr>";

			$sql = mssql_query("SELECT ROW_NUMBER() OVER (ORDER BY NIK) AS No, NIK,Nama FROM VTrackRecord WHERE NIK LIKE '%$keyword%' OR Nama LIKE '%$keyword%' GROUP BY NIK,Nama",$conn);
			while($row = mssql_fetch_array($sql)){
			  echo"<tr>
				 <td class=contentlist><a href='list_karir.php?show=list_track_record&amp;nik=$row[NIK]'>$row[No]</a></td>
				 <td class=contentlist><a href='list_karir.php?show=list_track_record&amp;nik=$row[NIK]'>$row[NIK]</a></td>
				 <td class=contentlist><a href='list_karir.php?show=list_track_record&amp;nik=$row[NIK]'>$row[Nama]</a></td>
				</tr>";
			}
			//echo"Ada";
		}
		else{
			echo"
			<tr>
			 <td align=center style='color:red; text-indent:50px;'><b>Maaf, Pencarian tidak ditemukan ...</b></td>
			</tr>
			";
			exit();
		}
	   echo'</table>
		  </td>
		 </tr>
		 <tr>
		  <td colspan=2>
		  <br><br><br>
		  <input type=button class=button value=Tambah onclick=Javascript:location.href="../form/frm_emp_track_record.php" /></td>
		 </tr>
		</table>
	';
}
// untuk PENCARIAN SANKSI
elseif($show == "sanksi"){
	echo"
		<table width=100%>
		 <tr>
		  <td colspan=2 class=line_bottom>&nbsp;&nbsp;<b>PENCARIAN DAFTAR SANKSI</b></td>
		 </tr>
		 <tr>
		  <td colspan=2>
		  <form method='get' action=search.php>
		   <table align=center>
		    <tr>
			 <td width=200>Masukkan NIK/Nama</td>
			 <td>
			 <input type='hidden' name='show' value='sanksi'>
			 <input type='text' name='keyword'><input type=submit value='Cari' class=button></td>
			</tr>
		   </table>
		  </form>
		  </td>
		 </tr>
		 <tr>
		  <td><hr noshade size=-2></td>
		 </tr>
		 <tr>
		  <td colspan=2>&nbsp;</td>
		 </tr>";
		$sql_num 	= mssql_query("SELECT * FROM VSanksi WHERE NIK LIKE '%$keyword%' OR Nama LIKE '%$keyword%' ",$conn);
		$cnt_num	= mssql_num_rows($sql_num);	
		
		if($cnt_num > 0){
		 echo"<tr>
		  <td colspan=2>
		   <table width=100%>
		    <tr class=headlist>
			 <td width=1%>No</td>
			 <td width=80>NIK</td>
			 <td>Nama</td>
			</tr>";

			$sql = mssql_query("SELECT ROW_NUMBER() OVER (ORDER BY NIK) AS No, NIK, Nama FROM VSanksi WHERE NIK LIKE '%$keyword%' OR Nama LIKE '%$keyword%' GROUP BY NIK,Nama",$conn);
			while($row = mssql_fetch_array($sql)){
			  echo"<tr>
				 <td class=contentlist><a href='list_karir.php?show=list_sanksi&amp;nik=$row[NIK]'>$row[No]</a></td>
				 <td class=contentlist><a href='list_karir.php?show=list_sanksi&amp;nik=$row[NIK]'>$row[NIK]</a></td>
				 <td class=contentlist><a href='list_karir.php?show=list_sanksi&amp;nik=$row[NIK]'>$row[Nama]</a></td>
				</tr>";
			}
			//echo"Ada";
		}
		else{
			echo"
			<tr>
			 <td align=center style='color:red; text-indent:50px;'><b>Maaf, Pencarian tidak ditemukan ...</b></td>
			</tr>
			";
			exit();
		}
	   echo'</table>
		  </td>
		 </tr>
		 <tr>
		  <td colspan=2>
		  <br><br><br>
		  <input type=button class=button value=Tambah onclick=Javascript:location.href="../form/frm_emp_sanksi.php" /></td>
		 </tr>
		</table>
	';
}
// untuk PENCARIAN PENUGASAN
elseif($show == "penugasan"){
	echo"
		<table width=100%>
		 <tr>
		  <td colspan=2 class=line_bottom>&nbsp;&nbsp;<b>PENCARIAN PENUGASAN</b></td>
		 </tr>
		 <tr>
		  <td colspan=2 align=center>
		  <form method='get' action=search.php>
		   <table>
		    <tr>
			 <td width=200 align=right>Masukkan NIK/Nama:</td>
			 <td>
			 <input type='hidden' name='show' value='penugasan'>
			 <input type='text' name='keyword'><input type=submit value='Cari' class=button></td>
			</tr>
		   </table>
		  </form>
		  </td>
		 </tr>
		 <tr>
		  <td><hr noshade size=-2></td>
		 </tr>
		 <tr>
		  <td colspan=2>&nbsp;</td>
		 </tr>";
		$sql_num 	= mssql_query("SELECT * FROM VPenugasan WHERE NIK LIKE '%$keyword%' OR Nama LIKE '%$keyword%' ",$conn);
		$cnt_num	= mssql_num_rows($sql_num);	
		
		if($cnt_num > 0){
		 echo"<tr>
		  <td colspan=2>
		   <table width=100%>
		    <tr class=headlist>
			 <td width=1%>No</td>
			 <td width=80>NIK</td>
			 <td>Nama</td>
			</tr>";

			$sql = mssql_query("SELECT ROW_NUMBER() OVER (ORDER BY NIK) AS No, NIK, Nama FROM VPenugasan WHERE NIK LIKE '%$keyword%' OR Nama LIKE '%$keyword%' GROUP BY NIK,Nama",$conn);
			while($row = mssql_fetch_array($sql)){
			  echo"<tr>
				 <td class=contentlist><a href='list_karir.php?show=list_tugas&amp;nik=$row[NIK]'>$row[No]</a></td>
				 <td class=contentlist><a href='list_karir.php?show=list_tugas&amp;nik=$row[NIK]'>$row[NIK]</a></td>
				 <td class=contentlist><a href='list_karir.php?show=list_tugas&amp;nik=$row[NIK]'>$row[Nama]</a></td>
				</tr>";
			}
			//echo"Ada";
		}
		else{
			echo"
			<tr>
			 <td align=center style='color:red; text-indent:50px;'><b>Maaf, Pencarian tidak ditemukan ...</b></td>
			</tr>
			";
			exit();
		}
	   echo'</table>
		  </td>
		 </tr>
		 <tr>
		  <td colspan=2>
		  <br><br><br>
		  <input type=button class=button value=Tambah onclick=Javascript:location.href="../form/frm_emp_penugasan.php" /></td>
		 </tr>
		</table>
	';
}
// untuk PENCARIAN PENILAIAN
elseif($show == "penilaian"){
	echo"
		<table width=100%>
		 <tr>
		  <td colspan=2 class=line_bottom>&nbsp;&nbsp;<b>PENCARIAN PENILAIAN</b></td>
		 </tr>
		 <tr>
		  <td colspan=2 align=center>
		  <form method='get' action=search.php>
		   <table>
		    <tr>
			 <td width=200 align=right>Masukkan NIK/Nama:</td>
			 <td>
			 <input type='hidden' name='show' value='penilaian'>
			 <input type='text' name='keyword'><input type=submit value='Cari' class=button></td>
			</tr>
		   </table>
		  </form>
		  </td>
		 </tr>
		 <tr>
		  <td><hr noshade size=-2></td>
		 </tr>
		 <tr>
		  <td colspan=2>&nbsp;</td>
		 </tr>";
		$sql_num 	= mssql_query("SELECT * FROM VLP WHERE NIK LIKE '%$keyword%' OR Nama LIKE '%$keyword%' ",$conn);
		$cnt_num	= mssql_num_rows($sql_num);	
		
		if($cnt_num > 0){
		 echo"<tr>
		  <td colspan=2>
		   <table width=100%>
		    <tr class=headlist>
			 <td width=1%>No</td>
			 <td width=80>NIK</td>
			 <td>Nama</td>
			</tr>";

			$sql = mssql_query("SELECT ROW_NUMBER() OVER (ORDER BY NIK) AS No, NIK, Nama FROM VLP WHERE NIK LIKE '%$keyword%' OR Nama LIKE '%$keyword%' GROUP BY NIK,Nama",$conn);
			while($row = mssql_fetch_array($sql)){
			  echo"<tr>
				 <td class=contentlist><a href='list_karir.php?show=list_nilai&amp;nik=$row[NIK]'>$row[No]</a></td>
				 <td class=contentlist><a href='list_karir.php?show=list_nilai&amp;nik=$row[NIK]'>$row[NIK]</a></td>
				 <td class=contentlist><a href='list_karir.php?show=list_nilai&amp;nik=$row[NIK]'>$row[Nama]</a></td>
				</tr>";
			}
			//echo"Ada";
		}
		else{
			echo"
			<tr>
			 <td align=center style='color:red; text-indent:50px;'><b>Maaf, Pencarian tidak ditemukan ...</b><br><br>
		  	<input type=button value=\"Tambah\" class=\"button\" onclick=Javascript:location.href=\"../form/frm_emp_fpenilaian.php\">
			 </td>
			</tr>
			";
			exit();
		}
	   echo'</table>
		  </td>
		 </tr>
		 <tr>
		  <td colspan=2>
		  <br><br><br>
		  <input type=button value="Tambah" class="button" onclick=Javascript:location.href="../form/frm_emp_fpenilaian.php">
		 </tr>
		</table>
	';
}

// untuk PENCARIAN CUTI
elseif($show == "cuti"){
	echo"
		<table width=100%>
		 <tr>
		  <td colspan=2 class=line_bottom>&nbsp;&nbsp;<b>PENCARIAN CUTI KARYAWAN</b></td>
		 </tr>
		 <tr>
		  <td colspan=2 align=center>
		  <form method='get' action=search.php>
		   <table>
		    <tr>
			 <td width=200 align=right>Masukkan NIK/Nama:</td>
			 <td>
			 <input type='hidden' name='show' value='cuti'>
			 <input type='text' name='keyword'><input type=submit value='Cari' class=button></td>
			</tr>
		   </table>
		  </form>
		  </td>
		 </tr>
		 <tr>
		  <td><hr noshade size=-2></td>
		 </tr>
		 <tr>
		  <td colspan=2>
		  <input type=button value=\"Tambah\" class=\"button\" onclick=Javascript:location.href=\"../form/frm_emp_cuti.php?show=cuti_khusus\">
		  </td>
		 </tr>";
		$sql_num 	= mssql_query("SELECT * FROM VCuti WHERE NIK LIKE '%$keyword%' OR Nama LIKE '%$keyword%' ",$conn);
		$cnt_num	= mssql_num_rows($sql_num);	
		
		if($cnt_num > 0){
		 echo"<tr>
		  <td colspan=2>
		   <table width=100%>
		    <tr class=headlist>
			 <td width=1%>No</td>
			 <td width=80>NIK</td>
			 <td>Nama</td>
			</tr>";

			$sql = mssql_query("SELECT ROW_NUMBER() OVER (ORDER BY NIK) AS No, NIK, Nama FROM VCuti WHERE NIK LIKE '%$keyword%' OR Nama LIKE '%$keyword%' GROUP BY NIK,Nama",$conn);
			while($row = mssql_fetch_array($sql)){
			  echo"<tr>
				 <td class=contentlist align='right'><a href='list_cuti.php?show=detail_cuti_khusus&amp;nik=$row[NIK]'>$row[No]</a></td>
				 <td class=contentlist><a href='listcuti.php?show=cuti_khusus&amp;nik=$row[NIK]'>$row[NIK]</a></td>
				 <td class=contentlist><a href='listcuti.php?show=cuti_khusus&amp;nik=$row[NIK]'>$row[Nama]</a></td>
				</tr>";
			}
			//echo"Ada";
		}
		else{
			echo"
			<tr>
			 <td align=center style='color:red; text-indent:50px;'><b>Maaf, Pencarian tidak ditemukan ...</b></td>
			</tr>
			";
			exit();
		}
	   echo'</table>
		  </td>
		 </tr>
		 <tr>
		  <td colspan=2>
		  <br><br><br>
		  <input type=button value="Tambah" class="button" onclick=Javascript:location.href="../form/frm_emp_cuti.php">
		 </tr>
		</table>
	';
}
// untuk PENCARIAN MEDICAL
elseif($show == "medical"){
	echo"
		<table width=100%>
		 <tr>
		  <td colspan=2 class=line_bottom>&nbsp;&nbsp;<b>PENCARIAN MEDICAL KARYAWAN</b></td>
		 </tr>
		 <tr>
		  <td colspan=2 align=center>
		  <form method='get' action=search.php>
		   <table>
		    <tr>
			 <td width=200 align=right>Masukkan NIK/Nama:</td>
			 <td>
			 <input type='hidden' name='show' value='medical'>
			 <input type='text' name='keyword'><input type=submit value='Cari' class=button></td>
			</tr>
		   </table>
		  </form>
		  </td>
		 </tr>
		 <tr>
		  <td><hr noshade size=-2></td>
		 </tr>
		 <tr>
		  <td colspan=2>
		  <input type=button value=\"Tambah\" class=\"button\" onclick=Javascript:location.href=\"../form/frm_emp_medical.php?show=cuti_khusus\">
		  </td>
		 </tr>";
		$sql_num 	= mssql_query("SELECT * FROM VSetupMedical WHERE NIK LIKE '%$keyword%' OR Nama LIKE '%$keyword%' ",$conn);
		$cnt_num	= mssql_num_rows($sql_num);	
		
		if($cnt_num > 0){
		 echo"<tr>
		  <td colspan=2>
		   <table width=100%>
		    <tr class=headlist>
			 <td width=1%>No</td>
			 <td width=80>NIK</td>
			 <td>Nama</td>
			</tr>";

			$sql = mssql_query("SELECT ROW_NUMBER() OVER (ORDER BY NIK) AS No, NIK, Nama FROM VSetupMedical WHERE NIK LIKE '%$keyword%' OR Nama LIKE '%$keyword%' GROUP BY NIK,Nama",$conn);
			while($row = mssql_fetch_array($sql)){
			  echo"<tr>
				 <td class=contentlist align='right'><a href='listmedical.php?show=detail_cuti_khusus&amp;nik=$row[NIK]'>$row[No]</a></td>
				 <td class=contentlist><a href='listmedical.php?show=historical&amp;nik=$row[NIK]'>$row[NIK]</a></td>
				 <td class=contentlist><a href='listmedical.php?show=historical&amp;nik=$row[NIK]'>$row[Nama]</a></td>
				</tr>";
			}
			//echo"Ada";
		}
		else{
			echo"
			<tr>
			 <td align=center style='color:red; text-indent:50px;'><b>Maaf, Pencarian tidak ditemukan ...</b></td>
			</tr>
			";
			exit();
		}
	   echo'</table>
		  </td>
		 </tr>
		 <tr>
		  <td colspan=2>
		  <br><br><br>
		  <input type=button value="Tambah" class="button" onclick=Javascript:location.href="../form/frm_emp_cuti.php">
		 </tr>
		</table>
	';
}
// untuk PENCARIAN SETUP_MEDICAL
elseif($show == "setup_medical"){
	echo"
		<table width=100%>
		 <tr>
		  <td colspan=2 class=line_bottom>&nbsp;&nbsp;<b>PENCARIAN SETUP MEDICAL KARYAWAN</b></td>
		 </tr>
		 <tr>
		  <td colspan=2 align=center>
		  <form method='get' action=search.php>
		   <table>
		    <tr>
			 <td width=200 align=right>Masukkan NIK/Nama:</td>
			 <td>
			 <input type='hidden' name='show' value='setup_medical'>
			 <input type='text' name='keyword'><input type=submit value='Cari' class=button></td>
			</tr>
		   </table>
		  </form>
		  </td>
		 </tr>
		 <tr>
		  <td><hr noshade size=-2></td>
		 </tr>
		 <tr>
		  <td colspan=2>
		  <input type=button value=\"Tambah\" class=\"button\" onclick=Javascript:location.href=\"../form/frm_emp_plafon.php?show=plafon_awal\">
		  </td>
		 </tr>";
		$sql_num 	= mssql_query("SELECT * FROM VSetupMedical WHERE NIK LIKE '%$keyword%' OR Nama LIKE '%$keyword%' ",$conn);
		$cnt_num	= mssql_num_rows($sql_num);	
		
		if($cnt_num > 0){
		 echo"<tr>
		  <td colspan=2>
		   <table width=100%>
		    <tr class=headlist>
			 <td width=1%>No</td>
			 <td width=80>NIK</td>
			 <td>Nama</td>
			</tr>";

			$sql = mssql_query("SELECT ROW_NUMBER() OVER (ORDER BY NIK) AS No, NIK, Nama FROM VSetupMedical WHERE NIK LIKE '%$keyword%' OR Nama LIKE '%$keyword%' GROUP BY NIK,Nama",$conn);
			while($row = mssql_fetch_array($sql)){
			  echo"<tr>
				 <td class=contentlist align='right'><a href='listmedical.php?show=setup_medical&amp;nik=$row[NIK]'>$row[No]</a></td>
				 <td class=contentlist><a href='listmedical.php?show=setup_medical&amp;nik=$row[NIK]'>$row[NIK]</a></td>
				 <td class=contentlist><a href='listmedical.php?show=setup_medical&amp;nik=$row[NIK]'>$row[Nama]</a></td>
				</tr>";
			}
			//echo"Ada";
		}
		else{
			echo"
			<tr>
			 <td align=center style='color:red; text-indent:50px;'><b>Maaf, Pencarian tidak ditemukan ...</b></td>
			</tr>
			";
			exit();
		}
	   echo'</table>
		  </td>
		 </tr>
		 <tr>
		  <td colspan=2>
		  <br><br><br>
		  <input type=button value="Tambah" class="button" onclick=Javascript:location.href="../form/frm_emp_cuti.php">
		 </tr>
		</table>
	';
}

?>
</td>
 </tr>
</table>
<br />
<? include("../footer.php"); //footer ?>
</body>
</html>
